package com.lele.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.lele.mapper.MenuRoleMapper;
import com.lele.pojo.MenuRole;
import com.lele.service.IMenuRoleService;
import com.lele.utils.Result;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author lele
 * @since 2022-11-26
 */
@Service
public class MenuRoleServiceImpl extends ServiceImpl<MenuRoleMapper, MenuRole> implements IMenuRoleService {
    @Resource
    private MenuRoleMapper menuRoleMapper;

    @Override
    public Result updateMenuRole(Integer rid, Integer[] mids) {
        //首先删除这个角色相关联的所有菜单，然后再全部添加。
        this.removeById(rid);
        menuRoleMapper.insertMenuRole(rid,mids);
        return Result.OK("更新成功");
    }
}
